import '../model/meal_model.dart';

import 'http_request.dart';

class ZSMealRequest {
  static Future<List<ZSMealModel>> getMealData() async {
    //1.发送网络请求
    final url = '/meal';
    final result = await HttpRequest.request(url);

    //2.json转model
    // print(result);
    final mealArray = result['meal'];
    List<ZSMealModel> meals = [];
    for (var json in mealArray) {
      meals.add(ZSMealModel.fromJson(json));
    }
    return meals;
  }
}
